<template>
	<view class="warp">
		<view class="status_bar">
			<!-- 这里是状态栏 -->
		</view>
		<view>
			<view class="header">
				<view class="header-left"></view>
				<view class="header-center">
					{{title}}
				</view>
				<view class="header-right" @click="close">
					<u-image
						src="/static/images/icon/close.png"
						width="60rpx"
						height="60rpx"
					></u-image>
				</view>
			</view>
			<view class="content">
				<u-parse 
					:content="content"
					:tagStyle="style"
				></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	import { getAgreement} from '@/config/api.js';
	
	export default {
		data() {
			return {
				type:'',
				title:'',
				content:'',
				style: {
					// 字符串的形式
				    p: "color: #6A707C;font-size:24rpx;line-height: 140%;letter-spacing: 0.48rpx;margin-bottom:20rpx",
				},
			}
		},
		onLoad(option) {
			this.type = option.type;
			this.getContent()
		},
		methods: {
			close(){
				uni.navigateBack()
			},
			getContent(){
				let that = this;
				let parames = {
					type:this.type
				}
				getAgreement({data:parames}).then((res) => {
					//success
					that.title = res.title;
					that.content = res.value;
				}).catch(() =>{
					
				})
			}
		}
	}
	
</script>

<style lang="scss" scoped>
	.warp{
		width: 100%;
		min-height: 100vh;
		background-color: #fff;
		
		.header{
			display: flex;
			justify-content: space-between;
			padding: 20rpx 40rpx;
			align-items: center;
			
			.header-left{
				width: 60rpx;
			}
			
			.header-center{
				color: #232426;
				font-size: 30rpx;
				font-weight: 500;
			}
		}
		.content{
			padding: 0 40rpx;
			margin-top: 56rpx;
		}
	}
</style>